cmake_minimum_required(VERSION 3.28)

# 设置源代码文件
file(GLOB SOURCES
        ${CMAKE_CURRENT_SOURCE_DIR}/server.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/ChatServer.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/ChatService.cpp
        ${PROJECT_SOURCE_DIR}/src/db/db.cpp
        ${PROJECT_SOURCE_DIR}/src/db/UserModel.cpp
        ${PROJECT_SOURCE_DIR}/src/db/OfflineMessageModel.cpp
        ${PROJECT_SOURCE_DIR}/src/db/FriendModel.cpp
        ${PROJECT_SOURCE_DIR}/src/db/GroupModel.cpp
        ${PROJECT_SOURCE_DIR}/src/db/Pool.cpp
        ${PROJECT_SOURCE_DIR}/src/redis/Redis.cpp

)
file(GLOB HEADERS
        ${CMAKE_CURRENT_SOURCE_DIR}/ChatServer.h
        ${CMAKE_CURRENT_SOURCE_DIR}/ChatService.h
        ${PROJECT_SOURCE_DIR}/src/base/DataBase.hpp
        ${PROJECT_SOURCE_DIR}/src/db/db.h
        ${PROJECT_SOURCE_DIR}/src/db/UserModel.h
        ${PROJECT_SOURCE_DIR}/src/db/OfflineMessageModel.h
        ${PROJECT_SOURCE_DIR}/src/db/FriendModel.h
        ${PROJECT_SOURCE_DIR}/src/db/GroupModel.h
        ${PROJECT_SOURCE_DIR}/src/db/Pool.h
        ${PROJECT_SOURCE_DIR}/src/redis/Redis.h
)

# 创建可执行文件
add_executable(server
        ${SOURCES}
        ${HEADERS}
)

message(STATUS "添加可执行文件：server")

# 设置链接的库
target_link_libraries(server PRIVATE
        muduo_net
        muduo_base
        pthread
        mysqlclient
        hiredis
        jsoncpp
)


